package tothreedesignmodel.adapter;

/**
 * @Author lzhphantom
 * @Description
 * @Date 创建于 13:57 2020/7/21
 * @Modified
 */
public class TwoWayAdapter implements TwoWayTarget, TwoWayAdaptee {
    private TwoWayTarget target;
    private TwoWayAdaptee adaptee;

    public TwoWayAdapter(TwoWayTarget target) {
        this.target = target;
    }

    public TwoWayAdapter(TwoWayAdaptee adaptee) {
        this.adaptee = adaptee;
    }

    @Override
    public void specificOne() {
        adaptee.specificOne();
    }

    @Override
    public void one() {
        target.one();
    }

    public static void main(String[] args) {
        TwoWayTarget target = new TwoWayAdapter(new TargetRealize());
        target.one();
        TwoWayAdaptee adaptee = new TwoWayAdapter(new AdpteeRealize());
        adaptee.specificOne();
    }
}
